﻿using _16.策略模式.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _16.策略模式
{
    internal class Client
    {
        public void Start()
        {
            double sumMoney = 10 * 18.5;//数量*单价=总价
            double realMoney = 0;//最终支付费用

            Console.WriteLine($"应付：{sumMoney}");

            PayContext context = new PayContext();

            //正常收费
            realMoney = context.GetResult(sumMoney);
            Console.WriteLine($"正常收费:{realMoney}");

            //扣扣收费
            context.SetPayMode(new RebatePay(0.85));
            realMoney = context.GetResult(sumMoney);
            Console.WriteLine($"扣扣收费:{realMoney}");

            //满减收费
            context.SetPayMode(new SubtractPay(100, 5));
            realMoney = context.GetResult(sumMoney);
            Console.WriteLine($"减收费:{realMoney}");
        }
    }
}
